<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Array.from的应用</title>
</head>

<body>
    <script>
        window.onload = () => {
            let collection = document.getElementsByTagName("div");
            Array.from(collection).forEach(item => item.style.background = "blue");
        }
    </script>
    <style type="text/css">
        div {
            width: 200px;
            height: 200px;
            margin-right: 1px;
            float: left;
        }
    </style>
    <div></div>
    <div></div>
    <div></div>
</body>

</html>